home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
001
/
pibt40s1.arc
/
HANGUP.MOD
< prev
next >
Wrap
Text File
|
1987-08-31
|
4KB
|
87 lines
(*----------------------------------------------------------------------*)
(* HangUpPhone --- Hang up the phone *)
(*----------------------------------------------------------------------*)
PROCEDURE HangUpPhone;
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: HangUpPhone *)
(* *)
(* Purpose: Hangs up the phone. *)
(* *)
(* Calling Sequence: *)
(* *)
(* HangUpPhone; *)
(* *)
(* *)
(* Calls: *)
(* *)
(* DELAY *)
(* Send_Modem_Command *)
(* Async_Close *)
(* Async_Open *)
(* Async_Purge_Buffer *)
(* *)
(* Remarks: *)
(* *)
(* First a hangup is tried by dropping DTR. If that fails, and *)
(* if a modem command delay string and a modem hang-up string *)
(* are specified, they are used. *)
(* *)
(*----------------------------------------------------------------------*)
VAR
Open_Flag : BOOLEAN;
Save_XonXoff : BOOLEAN;
BEGIN (* HangUpPhone *)
(* Make sure to clear XOFF received *)
(* flag. *)
Save_XonXoff := Async_Do_XonXoff;
Async_Do_XonXoff := FALSE;
IF ( Async_XOff_Received ) THEN
BEGIN
Async_XOff_Received := FALSE;
IF Do_Status_Line THEN
Write_To_Status_Line( ' ', 65 );
END;
(* Try hanging up by dropping DTR. *)
(* We do this by closing port with *)
(* DTR drop request. *)
Async_Close( TRUE );
(* Wait a second for DTR drop. *)
DELAY( One_Second_Delay );
(* Re-open the port. *)
Open_Flag := Async_Open( Comm_Port, Baud_Rate, Parity, Data_Bits,
Stop_Bits );
(* If modem hang-up command given, *)
(* use it if dropping DTR didn't work. *)
IF Async_Carrier_Detect THEN
IF ( Modem_Hang_Up[0] <> #0 ) THEN
BEGIN
DELAY( Modem_Escape_Time );
Send_Modem_Command( Modem_Escape );
DELAY( Modem_Escape_Time );
Send_Modem_Command( Modem_Hang_Up );
DELAY( Modem_Escape_Time );
END;
(* Swallow any garbage characters *)
Async_Purge_Buffer;
(* Restore previous Xon/Xoff status *)
Async_Do_XonXoff := Save_XonXoff;
END (* HangUpPhone *);